package com.kgc.server.dao;

import com.kgc.server.pojo.Collection;
import com.kgc.server.pojo.EasybuyProduct;
import com.kgc.server.pojo.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Mapper
public interface ProductDao {
    public List getProductList(Page page);

    public int getCount();

    public int delProductListById(int id);

    public List getProductListById(int id);

    public int updataProductListById(EasybuyProduct product);

    /**
     * 根据id获得商品详情
     * @param id
     * @return
     */
    public EasybuyProduct getProductById(String id);

    /**
     * 获取全部商品
     */
    public List<EasybuyProduct> getAllProduct();

    /**
     * 添加商品
     */
    public Integer addProduct(EasybuyProduct easybuyProduct);

    /**
     * 修改商品
     */
    public Integer modifyProduct(EasybuyProduct easybuyProduct);

    /**
     * 删除商品
     */
    public Integer delProduct(EasybuyProduct easybuyProduct);



    boolean setGoodsCollection(@Param("goodsID") int goodsID, @Param("userID")int userID);

    boolean delGoodsCollection(@Param("goodsID") int goodsID,@Param("userID")int userID);

    /**
     * 修改商品库存
     */
    public int modifyProductStock(@Param("id") Integer id,@Param("stock") Integer stock);

    public List<Collection> getCollection(@Param("goodsID")int goodsID,@Param("userID")int userID);

    public List getUserProductListByUserId(int userID);

    public List getCollectionFy(Page page);

    public int getCollectionCount(int userID);

    public int delCollectionByUserIdORID(@Param("userID")int userID,@Param("goodsID")int goodsID);

    public List getCollectionAll(@Param("userID")int userID);
}
